using System;
using System.Linq.Expressions;
using System.Reflection;
using Fuse8.DomainFramework.Practices.SystemFacade.Extensions;

namespace Fuse8.DomainFramework.Practices.SystemFacade
{
	static class ExpressionUtility<T>
	{
		public static PropertyInfo GetPropertyInfo<TT>(Expression<Func<T, TT>> expression)
		{
			return expression.Body.PropertyInfo();
		}

		public static MethodInfo GetMethodInfo<TT>(Expression<Func<T, TT>> expression)
		{
			return expression.Body.MethodInfo();
		}

		public static MethodInfo GetMethodInfo(Expression<Action<T>> expression)
		{
			return expression.Body.MethodInfo();
		}
	}
}